package Data::Timeline::Builder;

use strict;
use warnings;
use Data::Timeline;
use Data::Timeline::Entry;


our $VERSION = '0.03';


use base qw(Class::Accessor::Complex Class::Accessor::Constructor);


__PACKAGE__
    ->mk_constructor
    ->mk_abstract_accessors(qw(create));


sub make_timeline {
    my $self = shift;
    Data::Timeline->new(@_)
}


sub make_entry {
    my $self = shift;
    Data::Timeline::Entry->new(@_)
}


1;


__END__

{% USE p = PodGenerated %}

=head1 NAME

{% p.package %} - Base class for timeline builders

=head1 SYNOPSIS

    {% p.package %}->new;

    package Data::Timeline::SVK;
    use base 'Data::Timeline::Builder';

    sub create {
        my $self = shift;
        my $timeline = $self->make_timeline;
        for (...) {
            ...
            $timeline->entries_push($self->make_entry(
                timestamp   => ...,
                description => ...,
                type        => 'svk',
            ));
        }
        $timeline;
    }

=head1 DESCRIPTION

This is a base class for timeline builders. Subclasses need to implement the
C<create()> method.

=head1 METHODS

=over 4

{% p.write_methods %}

=item make_timeline

    my $timeline = $self->make_timeline;

Convenience method; returns a new L<Data::Timeline> object. Any arguments are
passed to C<Data::Timeline->new()>.

=item make_entry

    $timeline->entries_push($self->make_entry(...));

Convenience method; returns a new L<Data::Timeline::Entry> object. Any
arguments are passed to C<Data::Timeline::Entry->new()>.

=back

{% p.write_inheritance %}

{% PROCESS standard_pod %}

=cut

